﻿// owner 蒋家伟

#pragma once
#include "Device_home.h"

namespace jsdk
{
    class IDevice;
    // 设备管理器
    class DEVICE_EXPORT IDeviceManager
    {
    public:
        virtual ~IDeviceManager() {}

        /// \ 获取设备的单例
        static IDeviceManager* getFW();
        static const IDeviceManager* get();

        /// \ brief 通过设备名称获取设备
        /// \ in deviceName 设备名称
        /// \ return IDevice 设备对象接口
        virtual const IDevice* getDeviceByName(const std::wstring& deviceName) const = 0;

        /// \ brief 通过设备名称获取可修改的设备
        /// \ in deviceName 设备名称
        /// \ return IDevice 设备对象接口
        virtual IDevice* getDeviceFWByName(const std::wstring& deviceName) = 0;
    };
}

#define GET_CONST_DEVICE_BY_NAME(DEVICE_NAME) \
    IDeviceManager::get()->getDeviceByName(DEVICE_NAME)

#define GET_DEVICE_BY_NAME(DEVICE_NAME) \
    IDeviceManager::getFW()->getDeviceFWByName(DEVICE_NAME)